package cn.iocoder.yudao.module.dine.category.controller.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.dine.category.pojo.vo.DineCategoryVO;
import cn.iocoder.yudao.module.dine.category.service.app.AppDineCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserLastShopId;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * 前端控制器
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/07/18
 */
@Tag(name = "用户 APP - 菜品分类")
@RestController
@RequestMapping("/dine/category")
public class AppDineCategoryController {

    @Resource
    private AppDineCategoryService appDineCategoryService;

    @GetMapping("/list")
    @Operation(summary = "获得产品分类列表")
    @PermitAll
    public CommonResult<List<DineCategoryVO>> getCategoryList() {
        List<DineCategoryVO> list = appDineCategoryService.getEnableCategoryList(getLoginUserLastShopId());
        return success(list);
    }

}
